<link rel="stylesheet" href="resource/css/swiper.min.css" />
<script type="text/javascript" src="resource/js/swiper.min.js" ></script>
<div class="header header-categoryson" style="margin-top: 4.5rem;background-color:none; ">
    <form action="index.php">
        <input type="hidden" name="act" value="index">
        <input type="hidden" name="op" value="search">
        <i class="iconfont icon-sousuo"></i>
        <input type="text" name="title" placeholder="输入城市或者景点" />
    </form>
</div>
<div class="content content-bot content-home" style="margin-top:.5rem;">
    <div class="home-slide swiper-container">
        <ul class="swiper-wrapper">
            <?php foreach ($output['adverts'] as $adv): ?>
                <?php if ($adv['advert_type'] == 1): ?>
                    <li class="swiper-slide"><a href="<?php echo $adv['advert_url']; ?>"><img src="<?php echo $adv['advert_image']; ?>" /></a></li>
                <?php endif; ?>
            <?php endforeach; ?>
        </ul>
        <div class="swiper-pagination"></div>
    </div>
    <div class="home-theme">
        <ul>
            <?php foreach ($output['cates'] as $cate): ?>
                <li>
                    <a href="index.php?act=cate&op=sub&pid=<?php echo $cate['tc_id']; ?>">
                        <img src="<?php echo $cate['tc_icon']; ?>" />
                    </a>
                </li>
            <?php endforeach; ?>
        </ul>
        <div class="clear"></div>
    </div>
    <div class="home-recommend">
        <a href="index.php?act=index&op=search&recommend=1&more=1">
        <div class="recommend-title">
            <b>热门推荐<i class="iconfont icon-right_arraw"></i></b><br />
            <span>放价让你玩遍全中国</span>
        </div>
        </a>
        <div class="recommend-list commodity">
            <ul>
                <?php foreach ($output['tickets'] as $ticket): ?>
                    <a href="index.php?act=ticket&op=detail&tid=<?php echo $ticket['tk_id']; ?>">
                    <li>
                        <div class="commodity-img">
                            <img src="<?php echo $ticket['tk_thumb']; ?>" />
                        </div>
                        <div class="commodity-con">
                            <div class="commodity-title"><?php echo $ticket['tk_title']; ?></div>
                            <div class="commodity-brief"><?php echo $ticket['tk_subtitle']; ?></div>
                            <div class="commodity-location"><span><?php echo $ticket['tk_city_name']; ?></span></div>
                            <?php list($int, $float) = explode('.',$ticket['tk_show_price']); ?>
                            <div class="commodity-price"><b><samp>¥</samp><?php echo $int; ?>.<samp><?php echo $float; ?></samp></b><del>¥<?php echo $ticket['tk_market_price']; ?></del></div>
                        </div>
                        <div class="clear"></div>
                    </li>
                    </a>
                <?php endforeach; ?>
            </ul>
            <div class="recommend-more"><a href="index.php?act=index&op=search&recommend=1&more=1"><span>更多热门推荐</span></a></div>
        </div>
    </div>
<!--    <div class="home-cate">
        <a href="index.php?act=index&op=search&type=2&recommend=1">
        <div class="recommend-title">
            <b>特色美食<i class="iconfont icon-right_arraw"></i></b><br />
            <span>唯有爱情和美食不可辜负</span>
        </div>
        </a>
        <div class="cate-com">
            <ul>
                <?php /*foreach ($output['adverts'] as $adv): */?>
                    <?php /*if ($adv['advert_type'] == 2): */?>
                        <?php
/*                        if (strpos($adv['advert_name'], ',') !== false) {
                            list($str1, $str2) = explode(',',$adv['advert_name']);
                        } else {
                            $str1 = $adv['advert_name'];
                            $str2 = '';
                        }
                        */?>
                        <li><a href="<?php /*echo $adv['advert_url']; */?>"><img src="<?php /*echo $adv['advert_image']; */?>" /><div><span><?php /*echo $adv['advert_name']; */?></span></div></a></li>
                    <?php /*endif; */?>
                <?php /*endforeach; */?>
            </ul>
            <div class="clear"></div>
            <div class="recommend-more"><a href="index.php?act=index&op=search&type=2&recommend=1"><span>更多特色美食</span></a></div>
        </div>
    </div>-->
</div>

<script>
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
        loop: true,
        autoplay: 3000,
        autoplayDisableOnInteraction: false
    });

    $(function () {
        $('.cate-com li').each(function (i) {
            var that = $(this),
                img = that.find('img');
            img.height(img.width());
            that.find('div').width(img.width()).height(img.width());
        });
    });
</script>